<?php

declare(strict_types=1);

namespace App\Music\Model;

use App\Model\MusicSongs;
use Hyperf\Database\Model\SoftDeletes;
use Mine\MineModel;

/**
 * @property int $id ID
 * @property string $title 专辑名称
 * @property int $artist_id 歌手/艺术家 ID
 * @property string $release_date 发行日期
 * @property string $cover_art 封面图片 URL
 * @property string $desc 简介
 * @property string $updated_at 更新时间
 * @property string $deleted_at 删除时间
 */
class MusicAlbum extends MineModel
{
    use SoftDeletes;
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'music_album';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'title', 'artist_id', 'release_date', 'cover_art', 'desc', 'updated_at', 'deleted_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'artist_id' => 'integer'];

    /**
     * 歌曲列表
     * */
    public function song()
    {
        return $this->belongsToMany(MusicSong::class, 'music_song_artist_relation', 'artist_id', 'song_id');
    }



}
